<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="referrer" content="no-referrer">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>惠房首页-{{ citys }}房产网-{{ citys }}二手房|新房|租房|惠房信息地产【{{ citys }}惠房找房】</title>
    <!-- 使用favicon.ico图标 -->
    <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}" />
    <!-- 引用初始化init.css样式文件 -->
    <link rel="stylesheet" href="{{ url_for('static',filename='css/init.css') }}" />
    <!-- 引用首页的index.css样式文件 -->
    <link rel="stylesheet" href="{{ url_for('static',filename='css/index.css') }}">
</head>
<body>
    <!-- nav导航模块 -->
    <nav class="nav  clearfix">
        <div class="w">
            <div class="wrapper">
                <!-- logo模块 -->
                <div class="logo">
                    <a href="{{ url_for('house_bp.city') }}">
                        <img src="{{ url_for('static',filename='images/hz_logo.png') }}" alt="" title="惠房">
                    </a>
                    <div class="title">惠房</div>
                    <div class="zb">
                        <a href="{{ url_for('house_bp.city') }}">
                            <span>{{ city }}</span>
                        </a>
                    </div>
                </div>
                <!-- house模块 -->
                <div class="house">
                    <ul>
                        <li><a href="{{ url_for('house_bp.renthouse',city=city) }}">租房</a></li>
                        <li><a href="{{ url_for('house_bp.newhouse',city=city) }}">新房</a></li>
                        <li><a href="{{ url_for('house_bp.ershoufang',city=city) }}">二手房</a></li>
                        <li><a href="javascript:;">房屋手册</a></li>
                        <li><a href="http://112.74.83.39/movie/">影院</a></li>
                        <li><a href="http://120.79.190.101/user/">招聘</a></li>
                        <li><a href="javascript:;">下载APP</a></li>
                    </ul>
                </div>
                <!-- login模块 -->
                <div class="login">
                    {% if user %}
                        <!-- 惠房用户 -->
                        <ul class="user-list">
                            <li class="user-item">
                                <img src="{% if user.icon %}  {{ url_for('static',filename=user.icon) }} {% else %}{{ url_for('static',filename='images/Avatar.jpg') }}{% endif %}" alt="">
                            </li>
                            <li class="user-item" id="onclick">
                                <a href="javascript:;" class="username">欢迎 · {{ user.username }} <i class="swhe"></i></a>
                                <ul>
                                    <li class="user-info"><a href="{{ url_for('user_bp.user_center') }}">用户中心</a></li>
                                    <li class="user-info"><a href="{{ url_for('user_bp.logout') }}">退出登录</a></li>
                                </ul>
                            </li>
                        </ul>
                        <script>
                            // 显示与隐藏用户登录
                            // 1、获取元素
                            var li = document.querySelector('#onclick');
                            // 获取li标签的第二个子元素节点——ul标签
                            var uluser = li.children[1];
                            // 获取li标签的第一个子元素节点——a标签
                            var a = li.children[0];
                            var i = a.children[0];
                            // console.log(i);
                            var flag = 0;
                            a.onclick = function() {
                                if (flag == 0) {
                                    i.innerHTML = '';
                                    // console.log(i.innerText)
                                    uluser.style.display = 'block';
                                    flag = 1; // 赋值操作
                                }else {
                                    i.innerHTML = '';
                                    uluser.style.display = 'none';
                                    flag = 0;
                                };

                            };
                        </script>
                    {% else %}
                        <!-- 登录注册 -->
                        <div class="typeShowUser">
                            <span class="welcome">
                                <a href="{{ url_for('user_bp.login') }}">
                                    <span class="log">登录</span>
                                </a>
                                <span>&nbsp;/&nbsp;</span>
                                <a href="{{ url_for('user_bp.register') }}">
                                    <span class="regi">注册</span>
                                </a>
                            </span>
                        </div>
                    {% endif %}
                </div>
            </div>
        </div>
    </nav>

    <!-- header头部模块 -->
    <header class="header clearfix">
        <div class="w">
            <div class="head">
                <div class="head_tit">
                    <div class="title_small">
                        <span>要找房 来惠房 品质至上</span>
                    </div>
                    <div class="title_big">开始寻找属于你的那一份温暖</div>
                </div>
                <div class="house_list">
                    <ul>
                        <li>
                            <a href="{{ url_for('house_bp.renthouse',city=city) }}">
                                <span>{{ city }} 在售租房 {{ rent_num }} 间</span>
                            </a>
                        </li>
                        <li>
                            <a href="{{ url_for('house_bp.newhouse',city=city) }}">
                                <span>{{ city }} 在售新房楼盘 {{ new_num }} 个</span>
                            </a>
                        </li>
                        <li>
                            <a href="{{ url_for('house_bp.ershoufang',city=city) }}">
                                <span>{{ city }} 在售二手房 {{ sell_num }} 套</span>
                            </a>
                        </li>
                        <li>
                            <a href="{{ url_for('house_bp.dealershouhouse',city=city) }}">
                                <span>{{ city }} 成交二手房 {{ deal_num }} 套</span>
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </header>

    <!-- 房源推荐模块 -->
    <div class="main w">
        <!-- 二手房推荐 -->
        <div class="esf_house">
            <div class="main_hd">
                <div class="name">二手好房</div>
                <p>
                    好房源这么多，我们为您精选
                    <a href="{{ url_for('house_bp.ershoufang',city=city) }}">更多{{ city }}二手房</a>
                </p>
            </div>
            <ul>
                {% for sell in sell_data[:4] %}
                    <li class="esroom">
                        <a href="{{ url_for('house_bp.ershoufang',city=city) }}?sellid={{ sell.sell_id }}" class="maidian-detail" title="{{ sell.title }}">
                            <div class="detail">
                                <div class="dealimg">
                                    <img src="{{ sell.house_img }}" alt="">
                                </div>
                                <span class="goodhouse">
                                    <img src="{{ url_for('static',filename='images/godhouse.png') }}" alt="">
                                </span>
                                <div class="bottom">
                                    <div class="bot_hd">
                                        <p>{{ sell.area_name }}·{{ sell.shop_name }}·{{ sell.floor }}</p>
                                        <p>{{ sell.community }}</p>
                                    </div>
                                    <div class="bot_bd"> 
                                        {{ sell.house_type }} · {{ sell.bullde_area }}㎡
                                        <div class="price">{{ sell.total_price }}万</div>
                                    </div>
                                </div>
                            </div>
                        </a>
                    </li>
                {% endfor %}
            </ul>
        </div>
        <!-- 租房推荐 -->
        <div class="rent_house">
            <div class="main_hd">
                <div class="name">品质租房</div>
                <p>
                    高品质租房体验，轻松舒适生活
                    <a href="{{ url_for('house_bp.renthouse',city=city) }}">更多{{ city }}租房</a>
                </p>
            </div>
            <ul>
                {% for rent in rent_data[:4] %}
                    <li class="esroom">
                        <a href="{{ url_for('house_bp.renthouse',city=city) }}?rentid={{ rent.rent_id }}" class="maidian-detail" title="{{ rent.title }}">
                            <div class="detail">
                                <div class="dealimg">
                                    <img src="{{ rent.house_img }}" alt="">
                                </div>
                                <span class="goodhouse">
                                    <img src="{{ url_for('static',filename='images/bzhouse.png') }}" alt="">
                                </span>
                                <div class="bottom">
                                    <div class="bot_hd">
                                        <p>{{ rent.lease_mode }}·{{ rent.community }}&nbsp;&nbsp;{{ rent.house_face }}</p>
                                        <p>{{ rent.house_type }}</p>
                                    </div>
                                    <div class="bot_bd"> 
                                        {{ rent.shop_name }} / {{ rent.area }}
                                        <div class="price">{{ rent.rent_price }}元 {{ rent.payment }}</div>
                                    </div>
                                </div>
                            </div>
                        </a>
                    </li>
                {% endfor %}
            </ul>
        </div>
        <!-- 新房推荐 -->
        <div class="new_house">
            <div class="main_hd">
                <div class="name">优选新房</div>
                <p>
                    真实信息准确同步，楼盘动态一手掌握
                    <a href="{{ url_for('house_bp.newhouse',city=city) }}">更多{{ city }}新房</a>
                </p>
            </div>
            <ul>
                {% for new in new_data[:4] %}
                    <li class="esroom">
                        <a href="{{ url_for('house_bp.newhouse',city=city) }}?newid={{ new.house_unique }}" class="maidian-detail" title="{{ new.title }}">
                            <div class="detail">
                                <div class="dealimg">
                                    <img src="{{ new.house_img }}" alt="">
                                </div>
                                <span class="goodhouse">
                                    <img src="{{ url_for('static',filename='images/bzhouse.png') }}" alt="">
                                </span>
                                <div class="bottom">
                                    <div class="bot_hd">
                                        <p>{{ new.title }} / {{ new.proper_type }}</p>
                                        <p>{{ new.open_time }}</p>
                                    </div>
                                    <div class="bot_bd"> 
                                        <span>{{ new.adress }}</span>
                                        <div class="price">{{ new.unit_price }}元/平</div>
                                    </div>
                                </div>
                            </div>
                        </a>
                    </li>
                {% endfor %}
            </ul>
        </div>
    </div>

</body>
</html>